using NUnit.Framework;

namespace ValidationFramework.Tests
{
    [TestFixture]
    public class CompareStringRuleAttributeTest
    {
      

        [Test]
        public void CheckValues()
        {
            const string expectedCompareValue = "b";
            const CompareOperator expectedCompareOperator = CompareOperator.GreaterThan;
            var ruleAttribute = new CompareStringRuleAttribute(expectedCompareValue, expectedCompareOperator);
            Assert.AreEqual(expectedCompareValue, ruleAttribute.ValueToCompare);

            var propertyRule = (CompareRule<string>)ruleAttribute.CreateRule(new MockPropertyDescriptor<string>("foo"));
            var parameterRule = (CompareRule<string>)ruleAttribute.CreateRule(new MockParameterDescriptor<string>("foo"));

            Assert.AreEqual(expectedCompareValue, parameterRule.ValueToCompare);
            Assert.AreEqual(expectedCompareOperator, propertyRule.CompareOperator);

            Assert.AreEqual(expectedCompareValue, propertyRule.ValueToCompare);
            Assert.AreEqual(expectedCompareOperator, propertyRule.CompareOperator);

        }



        [Test]
        public void CallAttributeTester()
        {
            const string expectedCompareValue = "b";
            const CompareOperator expectedCompareOperator = CompareOperator.GreaterThan;
			AttributeTester.CheckDefaultValues<string>(new CompareStringRuleAttribute(expectedCompareValue, expectedCompareOperator), true, true);
            AttributeTester.CheckNonDefaultValues<string>(new CompareStringRuleAttribute(expectedCompareValue, expectedCompareOperator), true, true);
        }

    }
}